package cn.stylefeng.guns.modular.hp.domain;

import cn.stylefeng.guns.modular.hp.model.PresidentMailInfo;
import com.alibaba.druid.util.StringUtils;

import java.text.SimpleDateFormat;

/**
 * <p>
 * 院长信箱表DO
 * </p>
 *
 * @author xzqiang
 * @date 2019-05-26
 */
public class PresidentMailInfoDO {

    public PresidentMailInfoDO(){}

    public PresidentMailInfoDO(PresidentMailInfo info){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        this.id = info.getId();
        this.title = info.getTitle();
        this.content = info.getContent();
        this.senderName = StringUtils.isEmpty(info.getSenderName()) ? "匿名" : info.getSenderName();
        this.senderPhone = StringUtils.isEmpty(info.getSenderPhone()) ? "-" : info.getSenderPhone();
        this.senderEmail = StringUtils.isEmpty(info.getSenderEmail()) ? "-" : info.getSenderEmail();
        this.readStatus = info.getReadStatus() != null && info.getReadStatus() == 1 ? "已读" : "未读";
        this.readTime = info.getReadTime() == null ? "-" : sdf.format(info.getReadTime());
        this.createdTime = info.getCreatedTime() == null ? "-" : sdf.format(info.getCreatedTime());
    }


    /**
     * 主键ID
     */
    private String id;

    /**
     * 信件标题
     */
    private String title;

    /**
     * 信件内容
     */
    private String content;

    /**
     * 发信者名称
     */
    private String senderName;

    /**
     * 发信者电话
     */
    private String senderPhone;

    /**
     * 发信者邮箱
     */
    private String senderEmail;

    private String readStatus;

    private String readTime;

    /**
     * 创建时间
     */
    private String createdTime;

    /**
     * 乐观锁保留字段
     */
    private String version;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getSenderName() {
        return senderName;
    }

    public void setSenderName(String senderName) {
        this.senderName = senderName;
    }

    public String getSenderPhone() {
        return senderPhone;
    }

    public void setSenderPhone(String senderPhone) {
        this.senderPhone = senderPhone;
    }

    public String getSenderEmail() {
        return senderEmail;
    }

    public void setSenderEmail(String senderEmail) {
        this.senderEmail = senderEmail;
    }

    public String getReadStatus() {
        return readStatus;
    }

    public void setReadStatus(String readStatus) {
        this.readStatus = readStatus;
    }

    public String getReadTime() {
        return readTime;
    }

    public void setReadTime(String readTime) {
        this.readTime = readTime;
    }

    public String getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(String createdTime) {
        this.createdTime = createdTime;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    @Override
    public String toString() {
        return "PresidentMailInfo{" + "id=" + id + ", title=" + title + ", content=" + content ;
    }

}
